package com.example.demo.demos.configuration;

import com.example.demo.demos.filter.MyFilter;
import com.example.demo.demos.interceptor.MyInterceptor;
import com.example.demo.demos.listener.MyTomcatListener;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@EnableAspectJAutoProxy
public class BasicConfiguration implements WebMvcConfigurer{

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor());
    }

    @Bean
    public MyFilter myFilter(){
        return new MyFilter();
    }

    @Bean
    public MyTomcatListener myTomcatListener(){
        return new MyTomcatListener();
    }
}
